﻿<%@ Page Title="" Language="C#" MasterPageFile="~/GUI/MasterPage.master" AutoEventWireup="true" CodeFile="Platforms.aspx.cs" Inherits="Home_Platforms" %>

<%@ Register src="../Controls/Platform.ascx" tagname="Platform" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script type="text/javascript">
        function CheckNull() {
            var Name = document.getElementById('txtName');
            var ErrorPlatformName = document.getElementById('ErrorPlatformName');
            if (Name.value == "") {
                ErrorPlatformName.innerHTML = '<%=Language["ErrorNull"] %>';
                return false;
            } else if (!validText(Name.value)) {
                ErrorPlatformName.innerHTML = '<%=Language["ErrNotacceptScharacters"] %>';
                return false;
            } else {
                return true;
            }
        }
        //check special character
        function validText(value) {
            var chaos = new Array("'", "~", "@", "#", "$", "%", "^", "&", "*", ";", "/", "\\", "|","<",">");
            var sum = chaos.length;
            for (var i in chaos) { if (!Array.prototype[i]) { sum += value.lastIndexOf(chaos[i]) } }
            if (sum) {
                return false;
            }
            return true;
        }
    </script>
    <div class="First">
        <div class="IconTitle"><img src="../Images/icon_title.png"/></div>
        <div class="Title"><%=Language["Platform"]%></div>
    </div>
    <div class="Second">
        <uc1:Platform ID="Platform1" runat="server" />
        <div class="First">
            <div class="IconTitle"><img src="../Images/add.png"/></div>
             <div class="Title"><%= Language["AddNewPlatform"] %></div>
        </div>
        <div class="BoxAddPlatforms">
            <div class="PlatformItem1">
                <div class="ClassLabel"><%=Language["Name"] %>:</div>
                <input type="text" id="txtName" value="<%=currentPlatform.Name %>" name="txtName"/>
                <div class="ClassError1" id="ErrorPlatformName"></div>
            </div>
            <div class="PlatformItem2">
                <asp:Button Text="Add new platform" CssClass="BtnAddNewCategory" ID="btn_create" runat="server" BorderStyle="None" Font-Size="Medium" Height="36px" Width="346px" OnClientClick="return CheckNull();" OnClick="btn_create_Click"/>
            </div>
        </div>
    </div>
</asp:Content>

